
import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart';

import 'package:flutter_food_ordering_web/page/404_page.dart';
import 'package:flutter_food_ordering_web/page/checkout_page.dart';
import 'package:flutter_food_ordering_web/page/login_page.dart';
import 'package:flutter_food_ordering_web/page/store_page.dart';

class Routes {

  static String login = "/login";
  static String store = "/store";
  static String checkout = "/checkout";

  static void configureRoutes(Router router) {
    /// 指定路由跳转错误返回页
    router.notFoundHandler = Handler(
      handlerFunc: (BuildContext context, Map<String, List<String>> params) {
        debugPrint("未找到目标页");
        return PageNotFound();
      });

    router.define(login, handler: Handler(
      handlerFunc: (_, params) => LoginPage()));
    
    router.define(store, handler: Handler(
      handlerFunc: (_, params) => StorePage()));
    
    router.define(checkout, handler: Handler(
      handlerFunc: (_, params) => CheckoutPage()));
  }
}
